import 'package:flutter/material.dart';

///FloatingActionButton 和 扁平化按钮 FlatButton 的示例
class FloatingButtonSample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("FloatButton 按钮"),
      ),
      body: new Center(
        child: new Column(
          children: <Widget>[
            new Text(
              "FloatingActionButton 示例",
              style: new TextStyle(fontSize: 28),
            ),
            new FlatButton(
                onPressed: () {
                  print("扁平化按钮被点击了");
                },
              color: Colors.lightBlue,
                child: Text("这里是FlatButton"),
            )
          ],
        ),
      ),
      floatingActionButton: new Builder(builder: (BuildContext context) {
        return new FloatingActionButton(
            child: const Icon(Icons.add),
            tooltip: "请点击FloatingActionButton",
            foregroundColor: Colors.white,
            backgroundColor: Colors.blue,
            elevation: 7.0,
            highlightElevation: 14,
            onPressed: () {
              Scaffold.of(context).showSnackBar(new SnackBar(content: new Text("你点击了FloatingActionButton")));
            });
      }),
      floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
    );
  }
}
